package com.xinshujia.wxxcx.mapper;

import com.xinshujia.wxxcx.pojos.entity.Threshold;
import com.xinshujia.wxxcx.pojos.info.ThresholdInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author Cui Han
 * @Date 2024/5/17 17:47
 * @Description: TODO
 * @Version 1.0
 */
@Mapper
public interface ThresholdMapper {

    @Select("select  `date`, x_threshold,y_threshold,z_threshold,`name` from threshold WHERE machine_id = #{mchineId} and name is not null ORDER BY date DESC LIMIT 10;")
    List<ThresholdInfo> findThresholdInfo(Long machineId);

    @Select("select * from threshold where machine_id = #{mchineId} ORDER BY date DESC LIMIT 1")
    ThresholdInfo selectThreshold(Long machineId);

    @Insert("insert into threshold (machine_id,date,x_threshold,y_threshold,z_threshold,name)values (#{machineId},#{date},#{XThreshold},#{YThreshold},#{ZThreshold},#{name})")
    void insertThreshold(Threshold threshold);
}
